﻿namespace WMS6.Web.CustomizeReport
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class NSNPerformanceRptQuery : BasePage
    {
        protected Button btnSearch;
        protected DropDownList ddlCreatedDate;
        protected DropDownList ddlExtrernalLot;
        protected DropDownList ddlLotAttr01;
        protected DropDownList ddlReceiptID;
        protected DropDownList ddlSkuID;
        protected DropDownList ddlUdf10;
        protected DropDownList ddlVendorCity;
        protected DropDownList ddlVendorName;
        protected HtmlForm F16030;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected HtmlImage img3;
        protected Label lblCreatedDate;
        protected Label lblEndDateTime;
        protected Label lblExtrernalLot;
        protected Label lblLotAttr01;
        protected Label lblReceiptID;
        protected Label lblSkuID;
        protected Label lblStartDateTime;
        protected Label lblUdf10;
        protected Label lblVendorCity;
        protected Label lblVendorName;
        protected HtmlLink mycss;
        protected Label one1;
        protected TextBox txtCreatedDate;
        protected TextBox txtCreatedDate2;
        protected TextBox txtEndDateTime;
        protected TextBox txtExtrernalLot;
        protected TextBox txtLotAttr01;
        protected TextBox txtReceiptID;
        protected TextBox txtSkuID;
        protected TextBox txtStartDateTime;
        protected TextBox txtUdf10;
        protected TextBox txtVendorCity;
        protected TextBox txtVendorName;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("NSNPerformanceRptList.aspx", false);
        }

        private void InitDDl()
        {
            base.InitQueryDDL(this.ddlCreatedDate, 1);
            base.InitQueryDDL(this.ddlExtrernalLot, 0);
            base.InitQueryDDL(this.ddlLotAttr01, 0);
            base.InitQueryDDL(this.ddlReceiptID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlUdf10, 0);
            base.InitQueryDDL(this.ddlVendorCity, 0);
            base.InitQueryDDL(this.ddlVendorName, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDDl();
            }
        }

        public string CreatedDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCreatedDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCreatedDate.Text.Trim(), this.ddlCreatedDate.SelectedValue, this.txtCreatedDate2.Text.Trim(), "MOVEMENT_DATE");
                }
                return "";
            }
        }

        public string EndTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtEndDateTime.Text).ToString("yyyy-MM-dd") + " 23:59:59");
                }
                return "9999-01-01 23:59:59";
            }
        }

        public string ExtrernalLot
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExtrernalLot.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExtrernalLot.Text.Trim(), this.ddlExtrernalLot.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttr01
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttr01.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttr01.Text.Trim(), this.ddlLotAttr01.SelectedValue);
                }
                return "";
            }
        }

        public string ReceiptID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReceiptID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReceiptID.Text.Trim(), this.ddlReceiptID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string StartTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStartDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtStartDateTime.Text).ToString("yyyy-MM-dd") + " 00:00:00");
                }
                return "1990-01-01 00:00:00";
            }
        }

        public string UDF10
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtUdf10.Text.Trim()))
                {
                    return base.GetParamsString(this.txtUdf10.Text.Trim(), this.ddlUdf10.SelectedValue);
                }
                return "";
            }
        }

        public string VendorCity
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorCity.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorCity.Text.Trim(), this.ddlVendorCity.SelectedValue);
                }
                return "";
            }
        }

        public string VendorName
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorName.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorName.Text.Trim(), this.ddlVendorName.SelectedValue);
                }
                return "";
            }
        }
    }
}

